package com.syni.mdd.yhd.common.all.controller.protect.groupChat;

/**
 * @className BmsBusinessController
 * @description TOO
 * @Author cfx
 * @DATE 2019/4/15 14:25
 * @VERSION 1.0
 **/

import com.syni.mdd.sjb.common.component.utils.common.annotations.EntranceCheck;
import com.syni.mdd.yhd.common.all.dto.requestDto.groupChart.ChatAnnounReDto;
import com.syni.mdd.yhd.common.all.service.BmsDxGroupChatService;
import com.syni.mdd.yhd.common.all.validationGroup.GroupInsert;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/chatAnnoun")
public class BmsChatAnnounController {
    @Autowired
    BmsDxGroupChatService bmsDxGroupChatService;

    /**
     * @Description 创建群公告
     * @Param GroupChatReDto
     * @return Map
     * @Author: cfx
     * @Date: 2019/9/9
     */
    @PostMapping("/create")
    @EntranceCheck(checkAuth = true)
    public Map<String,Object> create(@RequestBody @Validated({GroupInsert.class}) ChatAnnounReDto chatAnnounReDto){
        return bmsDxGroupChatService.createAnnoun(chatAnnounReDto);
    }

    /**
     * @Description 查看群公告详情
     * @param chatAnnounReDto
     * @return
     */
    @PostMapping("/announDetail")
    @EntranceCheck(checkAuth = true)
    public Map<String,Object> announDetail(@RequestBody  ChatAnnounReDto chatAnnounReDto){
        return bmsDxGroupChatService.findAnnounDetail(chatAnnounReDto);
    }

    /**
     * @Description 查看群公告列表
     * @param chatAnnounReDto
     * @return
     */
    @PostMapping("/announList")
    @EntranceCheck(checkAuth = true)
    public Map<String,Object> announList(@RequestBody  ChatAnnounReDto chatAnnounReDto){
        return bmsDxGroupChatService.findAnnounList(chatAnnounReDto);
    }

    /**
     * @Description 删除群公告
     * @Param GroupChatReDto
     * @return Map
     * @Author: cfx
     * @Date: 2019/9/9
     */
    @PostMapping("/delete")
    @EntranceCheck(checkAuth = true)
    public Map<String,Object> delete(@RequestBody ChatAnnounReDto chatAnnounReDto){
        return bmsDxGroupChatService.deleteAnnoun(chatAnnounReDto);
    }


    /**
     * @Description 查看群公告列表（用户端）
     * @param chatAnnounReDto
     * @return
     */
    @PostMapping("/userGetAnnounList")
    @EntranceCheck(checkAuth = true)
    public Map<String,Object> userGetAnnounList(@RequestBody ChatAnnounReDto chatAnnounReDto){
        return bmsDxGroupChatService.userGetAnnounList(chatAnnounReDto);
    }

}
